package com.freesky.web.manager.util;

import com.freesky.common.exception.AjaxAuthorizationException;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.AuthorizationException;
import org.apache.shiro.subject.Subject;

/**
 * @author: 陈玉林
 * @modifiedBy:
 * @date: Create In 8:40 2019-01-06
 * @description:
 */
public class ShiroUtil {
    public static void volidateAuth(String permission) {
        Subject currentUser = SecurityUtils.getSubject();
        //权限不足
        if (!currentUser.isPermitted(permission)) {
            throw new AjaxAuthorizationException();
        }
    }
}
